package com.wanbangee.marksystem.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wanbangee.marksystem.service.SettingTopicNoMangerService;

@Controller
@RequestMapping("/SettingTopicNoManger")
public class SettingTopicNoMangerController {
	@Autowired
	private SettingTopicNoMangerService settingTopicNoMangerService;
	/**
	 * 将模板表的信息插入客观题和主观题
	 */
	@PostMapping("/insertIntoMOAndMSBySelectMAST")
	public void insertIntoMObjectiveAnswerAndMSubjectiveSetBySelectMAnswerSheetTemplate() {
		this.settingTopicNoMangerService.insertIntoMObjectiveAnswerAndMSubjectiveSetBySelectMAnswerSheetTemplate();
	}
	/**
	 * 通过exam_id和exam_sub_id查询这场模板考试的总分
	 * @param exam_id
	 * @param examSubId
	 * @return
	 */
	@ResponseBody
	@GetMapping("/selectTopicScoreTempTotal")
	public Map<String,Object> selectTopicScoreTempTotal(Integer examd,Integer examSubId){
		return this.settingTopicNoMangerService.selectTopicScoreTempTotal(examd, examSubId);
	}
	/**
	 * 查询客观题列表
	 * @return
	 */
	@ResponseBody
	@GetMapping("/selectMObjectiveAnswer")
	public Map<String,Object> selectMObjectiveAnswer(Integer examId,Integer examSubId){
		return this.settingTopicNoMangerService.selectMObjectiveAnswer(examId, examSubId);
	}
	/**
	 * 更新客观题
	 * @param rightAnswer
	 * @param topicScore
	 * @param isGainScore
	 * @param gainScore
	 * @return
	 */
	@ResponseBody
	@PutMapping("/updateMObjectiveAnswer")
	public Map<String,Object> updateMObjectiveAnswer(String rightAnswer,Double topicScore,Integer isGainScore ,Integer topicType,Double gainScore,String topicNo,Integer examId,Integer examSubId){
		return this.settingTopicNoMangerService.updateMObjectiveAnswer(rightAnswer, topicScore, isGainScore, topicType,gainScore, topicNo, examId, examSubId);
	}
	
	/**
	 * 查询主观题列表
	 * @return
	 */
	@ResponseBody
	@GetMapping("/selectMSubjectiveSet")
	public Map<String,Object> selectMSubjectiveSet(Integer examId,Integer examSubId){
		return this.settingTopicNoMangerService.selectMSubjectiveSet(examId, examSubId);
	}
	/**
	 * 更新主观题
	 * @param topicScore
	 * @param stepSize
	 * @param topicNo
	 * @return
	 */
	@ResponseBody
	@PutMapping("/updateMSubjectiveSet")
	public Map<String,Object> updateMSubjectiveSet(Double topicScore ,Integer stepSize,String topicNo,Integer examId,Integer examSubId){
		return this.settingTopicNoMangerService.updateMSubjectiveSet(topicScore, stepSize, topicNo, examId, examSubId);
	}
	/**
	 * 保存设置 （总分比对）
	 * @param examId
	 * @param examSubId
	 * @return
	 */
	@ResponseBody
	@GetMapping("/saveSetting")
	public Map<String,Object> saveSetting(Integer examId,Integer examSubId){
		return this.saveSetting(examId, examSubId);
	}

}
